package processors;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import util.StringUtil;

public class FrequencyProcessor {

	public Map<String, Integer> process(ArrayList<String> contents) {
		Map<String, Integer> frequency = new HashMap<String, Integer>();
		for (String content : contents) {
				ArrayList<String> words = StringUtil.lexicalAnalyze(content);
				for (String word : words) {
					if(word.equals(""))
						continue;
					if (frequency.containsKey(word)) {
						frequency.put(word, frequency.get(word) + 1);
					} else {
						frequency.put(word, 1);
					}
				}
		}
		return frequency;
	}

}
